﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using LSBLL;
using LSEntity;
using LSUtility;

namespace OralExamBLL
{
    public class OEAuthorizeTeacher : AuthorizeBase
    {
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            GetValue(filterContext);
            if (!IsLogin)
            {
                GoUrl(
                    String.Format("~/{0}/Login?url={1}",
                                  OEWebConfig.Area,
                                  HttpUtility.UrlEncode(filterContext.HttpContext.Request.Url.Obj2Str())));
            }
            if (IsStudent)
            {
                GoUrl(String.Format("~/{0}/Student", OEWebConfig.Area));
            }
        }
    }

    public class OEAuthorizeStudent : AuthorizeBase
    {
        public override void OnAuthorization(AuthorizationContext filterContext)
        {
            GetValue(filterContext);
            if (!IsLogin)
            {
                GoUrl(
                    String.Format("~/{0}/Login?url={1}",
                                  OEWebConfig.Area,
                                  HttpUtility.UrlEncode(filterContext.HttpContext.Request.Url.Obj2Str())));
            }
            if (IsTeacher)
            {
                GoUrl(String.Format("~/{0}/Teacher", OEWebConfig.Area));
            }
        }
    }
}
